<?php    
header('Content-type: application/xls');
header("Content-Disposition:attachment;filename=cvchithi.xls");

?>

<div class="nvchithis">
    <table>
            <tr><td colspan="4" align="center" style="font-weight: bold; ">
<? echo $tendv [0] ['zdvs'] ['tendvcha'];?>
            </td>
            <td colspan="4" align="center" style="font-weight: bold; ">CỘNG HÒA XÃ HỘI CHỦ NGHĨA VIỆT NAM</td>
            </tr>
            <tr>
            <td colspan="4" align="center" style="font-weight: bold; ">
             <?php
echo $tendv[0] ['zdvs'] ['tendv'];
?>
            
             </td>
                <td colspan="4" align="center" style="font-weight: bold; ">Độc lập- tự do- hạnh phúc</td>
            </tr>
            <tr>
            <td colspan="8" align="center" style="font-weight: bold; font-size: large;">
           CÁC CÔNG VIỆC THEO NỘI DUNG CÔNG VĂN - CHỈ THỊ 
            </td>
            </tr>
    </table>
	<?php 
                        
            //echo '<h3>CÁC CÔNG VIỆC THEO NỘI DUNG CÔNG VĂN - CHỈ THỊ <br/> ';
           // echo 'Đơn vị: '.$kh['Donvi']['tendv'].'<br/>';
            
          //  echo $kh['Thoigian']['tentg'];
            echo ' Từ: '.date('d-m-y',strtotime($kh['Thoigian']['ngaybd'])).' đến '.
                    date('d-m-y',strtotime($kh['Thoigian']['ngaykt'])).'. ';
?>  <?php echo 'Gồm '.count($nvchithis).' công việc';?>
	<table cellpadding="0" cellspacing="0"  border="1">
	<tr>
           <th style="background: #d5d5d5; font-weight: bold"><?php echo 'STT';?></th>
		
            <th style="background: #d5d5d5; font-weight: bold"><?php echo 'Người thực hiện';?></th>
            <th style="background: #d5d5d5; font-weight: bold"> <?php echo 'Nội dung công việc';?></th>
			
			<th style="background: #d5d5d5; font-weight: bold"><?php echo 'Đơn vị tính';?></th>
			<th style="background: #d5d5d5; font-weight: bold"><?php echo 'KQ cần đạt';?></th>
			<th style="background: #d5d5d5; font-weight: bold"><?php echo 'Ngày giao';?></th>
  	         <th style="background: #d5d5d5; font-weight: bold"><?php echo 'Hạn hoàn thành';?></th>
			<th style="background: #d5d5d5; font-weight: bold"><?php echo 'KQ thực hiện';?></th>
			
	</tr>
	<?php
	$i = 0;$q=1;$t=1;$b=1;
	foreach ($nvchithis as $nvchithi):
		$class = null;
		if ($i++ % 2 == 0) {
			$class = ' class="altrow"';
		}
	?>
	<tr<?php echo $class;?>>
   		<td><?php echo $i;//echo $nvchithi['Nvchithi']['id']; ?>&nbsp;</td>
	
		<td>
			<?php echo $nvchithi['Nhanvien']['tennv'];?>
		</td>
	
		<td><?php echo $nvchithi['Nvchithi']['congviec']; ?>&nbsp;</td>
        	<td>
			<?php echo $nvchithi['Dvt']['donvitinh']; ?>
		</td>
		<td><?php echo $nvchithi['Nvchithi']['ketqua']; ?>&nbsp;</td>
        <td><?php echo date('d/m/Y',strtotime($nvchithi['Nvchithi']['ngaygiao'])); ?>&nbsp;</td>
		
		<td><?php echo date('d/m/Y',strtotime($nvchithi['Nvchithi']['thoihan'])); ?>&nbsp;</td>
		<td><?php echo $nvchithi['Nvchithi']['danhgia']; ?>&nbsp;</td>
	</tr>
<?php endforeach; ?>
	</table>
    
</div>
